import axios from "axios";
export  function userMessage() {
    return axios.get(`/api/pcUser/login-user/info`)
}
export  function escUser() {
    return axios.get(`/api/pcUser/logout`)
}
export  function changeImg(file) {
    let obj=new FormData();
    obj.append('file',file)
    return axios.post(`/api/pcUser/updata/userAvatar`,obj)
}
export  function changeNameRequest(nickname,sex,email) {
    let obj={
        "nickname":nickname,
        "sex":sex,
        "email":email
    }
    return axios.post(`/api/pcUser/update/userInfo`,obj)
}
export  function changeCode(mobile) {
    return axios.get(`/api/pcUser/edit-password/send/code/${mobile}`)
}
export  function changePhone(mobile,code) {
    let obj={
        "mobile":mobile,
        "code":code,
    }
    return axios.post(`/api/pcUser/update/userMobile`,obj)
}
export  function changePasswordCode(mobile) {
    return axios.get(`/api/pcUser/edit-password/send/code/${mobile}`)
}
export function changePassword(oldPassword,newPassword,checkNewPassword,mobile,code) {
    let obj=new URLSearchParams();
    obj.append('oldPassword', oldPassword)
    obj.append('newPassword', newPassword)
    obj.append('checkNewPassword', checkNewPassword)
    obj.append('mobile', mobile)
    obj.append('code', code)
    return axios.post(`/apipcUser/update/userPassword`, obj)
}